# -*- coding: cp936 -*-
import re,urllib,urllib2
savepath ='d:\\AR'
url = 'http://tutorial-haartraining.googlecode.com/svn/trunk/data/negatives/'
urlSource = urllib.urlopen(url).read()
#print urlSource
pattern = re.compile('<a href="(.*?)">')
match = pattern.findall(urlSource,re.S)
count = 0
if match:
 for subUrl in match:
    if count!=0:#because the first subUrl is not the correct string
        print subUrl
        f=open(savepath+'\\'+subUrl,'wb')
        f.write(urllib2.urlopen(urllib2.Request(url+subUrl)).read())
        f.close
    count = count+1
